	function runApplet()
	{
		var applet = document.MainAlgorithm;
		var resultsBox = document.getElementById('resultsBox').value;

		var xmlPath = document.getElementById('xmlPath').value;
		applet.setFilename(xmlPath);
		
		var dimension = document.getElementById('dimension').value;
		applet.setDimension(dimension);

		var delta = document.getElementById('delta').value;
		applet.setDelta(delta);

		var tau = document.getElementById('tau').value;
		applet.setThreshold(tau);

		var infNorm = document.getElementById('infNorm').value;
		applet.setInfNorm(infNorm);

		document.getElementById('resultsBox').value = "Running, please be patient...";
		document.getElementById('statusImage').src = "htmlResources/redButton.jpg";

		alert("Ready to run. Hit OK");
		var coeffsCount = applet.Run();

		if(coeffsCount == -2)
		{
			alert("Could not locate XML file: " + xmlPath +"\nMake sure name entered correctly");
			return;
		}
		else if(coeffsCount == -3)
		{
			alert("Unable to load XML file, make sure XML is formatted correctly");
			return;
		}
		else if(coeffsCount == -1)
		{
			alert("Error: "+ applet.getLastError());
			return;
		}
		alert("Found "+ coeffsCount + " coefficients");
		
		document.getElementById('resultsBox').value = "";

			
		for (i=1;i<=coeffsCount ;i++)
		{
			var currentCoeff = applet.UnloadCoefficient();
			document.getElementById('resultsBox').value += currentCoeff + '\n';
		}
		document.getElementById('statusImage').src = "htmlResources/greenButton.jpg";

	}

	function clearForm()
	{
		document.getElementById('xmlPath').value = "";		
		document.getElementById('dimension').value = "";
		document.getElementById('delta').value = "";
		document.getElementById('tau').value = "";
		document.getElementById('infNorm').value = "";
		document.getElementById('resultsBox').value = "";

	}

	function displayHelp()
	{
		alert("Enter path relative to current folder or in following format:\nfile:/[DRIVE_LETTER]:/[FOLDER]/.../[FILE_NAME].xml");
	}